package demo1;

import java.util.HashMap;
import java.util.Map;

public class Test {
    public static void main(String[] args) {
        HashMap<String, Integer> map = new HashMap<>();
        map.put("abcd", 2);
        map.put("hello", 10);
        map.put("gao", 3);

        Integer val = map.get("abcd");
        System.out.println(val);

        System.out.println(map);
        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            System.out.println("key: " + entry.getKey() + " val: " + entry.getValue());
        }
        //不支持迭代器遍历
    }
    public static void main1(String[] args) {
        HashBuck hashBuck = new HashBuck();
        hashBuck.put(1,11);
        hashBuck.put(2,22);
        hashBuck.put(9,100);
        hashBuck.put(5,99);
        hashBuck.put(4,99);
        hashBuck.put(7,99);
        hashBuck.put(3,99);
        hashBuck.put(8,99);
        hashBuck.put(10,99);
        HashMap<Integer, String> hashMap = new HashMap<>();
        System.out.println(hashBuck.get(9));
    }
}
